import ajax from '../util/request'
// 角色列表
export const rolesAjax = (params) => ajax({
    method:'get',
    url:'/roles',
    params,
    headtype:'form'
}) 
// 添加角色
export const addrolesAjax = (params) => ajax({
    method:'post',
    url:'/roles',
    params,
    headtype:'form'
}) 

// 删除角色
export const delrolesAjax = (params) => ajax({
    method:'delete',
    url:'/roles/'+params.id,
    params:{},
    headtype:'form'
}) 

// 删除权限
export const delRightAjax = (url) => ajax({
    method:'delete',
    url,
    params:{},
    headtype:'form'
}) 

// 根据ID查询角色
export const getrolebyIdAjax = (url) => ajax({
    method:'get',
    url,
    params:{},
    headtype:'form'
}) 

// 修改角色
export const resetroleAjax = (url,params) => ajax({
    method:'put',
    url,
    params,
    headtype:'form'
}) 

// 获取权限列表
export const getRightAjax = (url) => ajax({
    method:'get',
    url:"rights/tree",
    params:{},
    headtype:'form'
})

// 角色授权
export const setRightAjax = (id,params) => ajax({
    method:'post',
    url:"roles/"+id+'/rights',
    params,
    headtype:'form'
})


